using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Xml;

namespace Umdf.SideShow.Scf.ObjectModel
{
    public abstract class ScfBodyElement : ScfObject
    {
        private uint _id;
        private string _title = string.Empty;

        protected ScfBodyElement()
        {
        }

        public uint Id
        {
            get { return _id; }
            set { _id = value; }
        }

        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        protected internal override void DeserializeFromXml(XmlNode node)
        {
            base.DeserializeFromXml(node);
            _id = GetAttribute<uint>(node, "id");
            _title = GetAttribute<string>(node, "title", string.Empty);
        }

        protected internal override void SerializeObject(System.IO.BinaryWriter writer)
        {
            base.SerializeObject(writer);
            writer.Write(_id);
            writer.Write(_title);
        }

        protected internal override void DeserializeObject(System.IO.BinaryReader reader)
        {
            base.DeserializeObject(reader);
            _id = reader.ReadUInt32();
            _title = reader.ReadString();
        }
    }
}
